home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / doc / plot08 < prev    next >
Text File  |  1997-07-08  |  635b  |  33 lines

  1. ; This batch file creates a plot used in Chapter 10, "Plotting",
  2. ; of _Using IDL_.
  3.  
  4. ;  Create a data array.
  5.  
  6. X = FLTARR(256)    
  7.  
  8. ; Make a step function. Array elements 80 through 120 are set to 1.
  9.  
  10. X(80:120) = 1    
  11.  
  12. ; Make a filter.
  13.  
  14. FREQ = FINDGEN(256)
  15.  
  16. ; Make the filter symmetrical about the value x =128.
  17.  
  18. FREQ = FREQ < (256-FREQ)
  19.  
  20. ; The filter is a second order Butterworth filter,
  21. ; with a cutoff frequency = 20.
  22.  
  23. FIL = 1./(1+(FREQ/20)^2)
  24.  
  25. ; Plot with a logarithmic x-axis. Use exact axis range.
  26.  
  27. PLOT, /YLOG, FREQ, ABS(FFT(X,1)), $
  28.     XTITLE = 'Relative Frequency', YTITLE = 'Power', XSTYLE = 1    
  29.  
  30. ; Plot graph. 
  31.  
  32. OPLOT, FREQ, FIL    
  33.